package com.sqx.modules.app.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sqx.common.utils.Result;
import com.sqx.modules.app.entity.UserEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 用户
 */
@Mapper
public interface UserDao extends BaseMapper<UserEntity> {


    IPage<UserEntity> selectUserPage(Page<UserEntity> page, String search, Integer sex, String platform, String sysPhone, Integer status,
                                     Integer type, String userName, Integer isVip, Integer shopAdminFlag);

    int queryInviterCount(@Param("inviterCode") String inviterCode);

    int queryUserCount(@Param("type") int type, @Param("date") String date);

    Double queryPayMoney(@Param("type") int type, @Param("date") String date);

    IPage<Map<String, Object>> queryCourseOrder(Page iPage, @Param("type") int type, @Param("date") String date);

    int userMessage(String date, int type);

    int insertUser(UserEntity userEntity);

    IPage<Map<String, Object>> takingOrdersMessage(Page<Map<String, Object>> iPage, @Param("type") Long type, @Param("date") String date);


    IPage<UserEntity> selectUserList(Page<UserEntity> iPage, String userName);


    int updateCashDeposit(@Param("userId") Long userId,@Param("cashDeposit") Double cashDeposit);

    void updateMoney(Integer type, Long userId, Double money);

    UserEntity selectUserById(Long userId);

    IPage<UserEntity> selectUser(Page<UserEntity> pages, String userName, String phone);

    int topUpMoney(@Param("classify") Integer classify, @Param("orderId") String out_trade_no, @Param("money") Double money, @Param("userId") Long userId, @Param("state") Integer state, @Param("date") String date, @Param("date1") String date1, @Param("type") Integer type);

    int certification(@Param("userId") Long userId,@Param("phone") String phone, @Param("userName") String userName,
                      @Param("identityCardNumber") String identityCardNumber,@Param("identityCardFront") String identityCardFront,
                      @Param("identityCardVerso") String identityCardVerso,  @Param("selfIdentityCard") String selfIdentityCard,
                      @Param("format") String format,@Param("checkNumber") String checkNumber, @Param("cashDeposit") BigDecimal cashDeposit);

    Result shopBindingQrCode(Long userId, String cashQrCode);

    void userFeedback(Integer feedbackType,Long userId, String userEmail, Integer feedbackScore, String feedbackMessage, String format);

    int addRedPacket(@Param("userId") Long userId, @Param("redPacketType")String redPacketType, @Param("minimumAmount")BigDecimal minimumAmount,@Param("redPacketAmount") BigDecimal redPacketAmount,@Param("redPacketTitle") String redPacketTitle,@Param("expirationTime") String expirationTime, @Param("createTime")String createTime);

    int updateOldUser(Long userId);

    UserEntity selectUserMessage(Long userId);

    List<UserEntity> selectVipOverdue(String date);
}
